package com.totcy.atom.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.totcy.atom.R;
import com.totcy.atom.bean.PaperBean;
import com.totcy.baselibrary.adapter.BaseLoadMoreAdapter;
import com.totcy.baselibrary.adapter.BaseViewHolder;

import java.util.List;

public class PaperListAdapter extends BaseLoadMoreAdapter<PaperBean, BaseViewHolder, BaseViewHolder> {
    public PaperListAdapter(Context mContext, List<PaperBean> mDatas) {
        super(mContext, mDatas);
    }

    @Override
    public boolean hasHeader() {
        return false;
    }

    @Override
    protected BaseViewHolder onCreateItemViewHolder(ViewGroup parent, int viewType) {
        return new BaseViewHolder(getItemView(R.layout.item_paper, parent));
    }

    @Override
    protected void onBindItemViewHolder(BaseViewHolder holder, int position) {
        PaperBean paperBean = mDatas.get(position);
        TextView title = holder.getView(R.id.tv_title);
        title.setText(paperBean.getTitle());

        TextView level = holder.getView(R.id.tv_level);
        level.setText(String.format("等级：%s", paperBean.getLevelName()));

        TextView count = holder.getView(R.id.tv_questionCount);
        count.setText(String.format("共 %s 道题", paperBean.getQuestions_count()));

    }

    @Override
    protected BaseViewHolder onCreateHeaderViewHolder(ViewGroup parent, int viewType) {
        return null;
    }

    @Override
    protected void onBindHeaderViewHolder(BaseViewHolder holder) {

    }
}
